﻿using Stardust.Client;
using Stardust.Common.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ClientTest
{

    public class User
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Msg { get; set; }

    }

    class Program
    {

        static void Main(string[] args)
        {
            StardustClient.SetConfigCenterUrl("http://localhost:85");

            var index = 1;
            while (true)
            {
                var node1Client = new StardustClient("用户服务", "1.1+");
                try
                {
                    var result = node1Client.Invoke<string>("User", "Say", new { name = "Name" + index++ });
                    Console.WriteLine(SerializerHelper.SerializeToString(result));
                }
                catch (Exception exp)
                {
                    Console.WriteLine(exp.Message);
                }
                Thread.Sleep(500);
            }
        }
    }
}
